
public class Atom extends Data {
	private Object data;

	public Atom(Object _data) {
		data = _data;
	}

	@Override
	public boolean isAtom() {
		return true;
	}

	@Override
	public boolean isList() {
		return isNull();
	}

	@Override
	public boolean isNull() {
		return data == null;
	}

	@Override
	public boolean isPair() {
		return false;
	}

	@Override
	public String toString() {
		if (isNull()) {
			return "()";
		}
		return data.toString();
	}

	public Object value() {
		return data;
	}

	@Override
	public boolean isBoolean() {
		return false;
	}

	@Override
	public boolean isNumber() {
		try {
			int i = ((Integer)data).intValue();
			i++; // To make Eclipse stop complaining.

		} catch (ClassCastException e) {
			return false;
		} catch (NullPointerException e) {
			return false;
		}
		return true;
	}

	@Override
	public Object getValue() {
		return data;
	}

	public void setValue(Object _data) {
		data = _data;
	}
	//
	//	@Override
	//	public boolean isEmpty() {
	//		return data == null;
	//	}

	@Override
	public boolean equals(Object other) {
		if (!getClass().equals(other.getClass())) {
			return false;
		} else if (data != null){
			return data.equals(((Atom)other).data);
		} else {
			return data == ((Atom)other).data;
		}
	}

	@Override
	public int compareTo(Data o) {
		return this.toString().compareTo(o.toString());
	}


}
